<?php
$dbms='mysql';     //数据库类型
//$host='localhost'; //数据库主机名
//$dbName='light';    //使用的数据库
//$user='root';      //数据库连接用户名
//$pass='asJaH21Kc';          //对应的密码
$host='10.66.203.63'; //数据库主机名
$dbName='lighter_longyue8_com';    //使用的数据库
$user='lighter';      //数据库连接用户名
$pass='lighter_longyue8_com';          //对应的密码
$dsn="$dbms:host=$host;dbname=$dbName";

$dbh = new PDO($dsn, $user, $pass); //初始化一个PDO对象
$dbh->query('SET NAMES utf8')->execute();

$query = $dbh->query('SELECT * from user');
//var_dump($xxx->fetchAll(PDO::FETCH_ASSOC));
$list = $query->fetchAll(PDO::FETCH_ASSOC);

;?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <table border="1" cellpadding="10" width="800">
        <tr>
            <th>姓名</th>
            <th>电话</th>
            <th>时间</th>
        </tr>
        <?php foreach($list as $v):?>
        <tr>
            <th><?=$v['username'];?></th>
            <th><?=$v['tel'];?></th>
            <th><?=date('Y-m-d H:i:s',$v['created_at']);?></th>
        </tr>
        <?php endforeach;?>
    </table>
</body>
</html>
